//
//  GYRefundListTableViewCell.m
//  GoodLuck
//
//  Created by 郭为勇 on 2018/3/25.
//  Copyright © 2018年 yunjiazhineng. All rights reserved.
//

static NSString *refundListCellIdentifier = @"refundListCellIdentifier";

#import "GYRefundListTableViewCell.h"

@interface GYRefundListTableViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *storeNameLable;
@property (weak, nonatomic) IBOutlet UILabel *refundStateLable;
@property (weak, nonatomic) IBOutlet UIImageView *goodsImageView;
@property (weak, nonatomic) IBOutlet UILabel *goodsNameLable;
@property (weak, nonatomic) IBOutlet UILabel *refundTimeLable;
@property (weak, nonatomic) IBOutlet UILabel *refundMOneyLable;
@property (weak, nonatomic) IBOutlet UIButton *refundDetailsBtu;
@property (weak, nonatomic) IBOutlet UILabel *markLbale;


@end
@implementation GYRefundListTableViewCell

- (IBAction)refundDetailsBtuClcik:(UIButton *)sender {
    self.refunddDetailsCallBack();
}

+ (instancetype)cellWithTableView:(UITableView *)tableView {
    GYRefundListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:refundListCellIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] firstObject];
    }
    
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.refundDetailsBtu.layer.cornerRadius = 4;
    self.refundDetailsBtu.layer.borderColor = RGBColor(221, 221, 221).CGColor;
    self.refundDetailsBtu.layer.borderWidth = 1;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (void)setRefundListModel:(GYRefundList *)refundListModel {
    _refundListModel = refundListModel;
    
    //赋值
    self.storeNameLable.text = refundListModel.store_name;
    self.refundStateLable.text = refundListModel.seller_state;
    
    [self.goodsImageView sd_setImageWithURL:[NSURL URLWithString:[[refundListModel.goods_list firstObject] goods_img_360]] placeholderImage:[UIImage imageNamed:@"4"]];
    self.goodsNameLable.text = refundListModel.goods_name;
    self.refundTimeLable.text = refundListModel.add_time;
    self.refundMOneyLable.text = [NSString stringWithFormat:@"¥%@",refundListModel.refund_amount];
    
}

- (CGFloat)getHeight:(GYRefundList *)model {
    self.refundListModel = model;
    
    [self layoutIfNeeded];
    
    return CGRectGetMaxY(self.markLbale.frame);
}
@end
